package com.qf.dto;

import org.springframework.util.DigestUtils;
import org.springframework.util.StringUtils;

import java.nio.charset.StandardCharsets;
import java.util.UUID;

public class Md5 {

    public static String RandomSalt(){
        return StringUtils.replace(UUID.randomUUID().toString(), "-","").substring(0,10);
    }

    public static String Md5AndSalt(String salf,String password ){
        String valueOf = String.valueOf((salf + password).hashCode());
        String newPssword = DigestUtils.md5DigestAsHex(valueOf.getBytes(StandardCharsets.UTF_8));

        return  newPssword;
    }

}
